package logic

import (
	"context"
	"house_srv/models"

	"house_srv/house"
	"house_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type TokenAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewTokenAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TokenAddLogic {
	return &TokenAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 看房反馈
func (l *TokenAddLogic) TokenAdd(in *house.TokenAddRequest) (*house.TokenAddResponse, error) {
	// todo: add your logic here and delete this line
	tokers := models.Toker{
		UserId:  int(in.UserId),
		Context: in.Context,
	}
	models.DB.Debug().Create(&tokers)
	return &house.TokenAddResponse{
		Id: int64(tokers.ID),
	}, nil
}
